<template>
    <div id="app">
        <div class="layout">
            <Layout>
                <Sider ref="side1" hide-trigger collapsible :collapsed-width="78" v-model="isCollapsed">
                    <Menu active-name="1-2" theme="dark" width="auto" :class="menuitemClasses">
                        <div class="layout-logo-left"></div>
                        <!--<sidebar></sidebar>-->
                        <MenuItem name="1-1">
                            <Icon type="ios-navigate"></Icon>
                            <span>主面板</span>
                        </MenuItem>
                        <MenuItem name="1-2">
                            <Icon type="ios-navigate"></Icon>
                            <span>警报配置</span>
                        </MenuItem>
                        <MenuItem name="1-3">
                            <Icon type="ios-navigate"></Icon>
                            <span>总单列表</span>
                        </MenuItem>
                    </Menu>
                </Sider>
                <Layout>
                    <Header :style="{padding: 0}" class="layout-header-bar">
                        <Icon @click.native="collapsedSider" :class="rotateIcon" :style="{margin: '20px 20px 0'}" type="navicon-round" size="24"></Icon>
                    </Header>
                    <Content class="layout-copy">
                        <router-view></router-view>
                    </Content>
                </Layout>
            </Layout>
        </div>
    </div>
</template>
<script>
    import sidebar from './components/sidebar.vue'
    export default {
        components:{
            sidebar
        },
        data () {
            return {
                isCollapsed: false
            }
        },
        computed: {
            rotateIcon () {
                return [
                    'menu-icon',
                    this.isCollapsed ? 'rotate-icon' : ''
                ];
            },
            menuitemClasses () {
                return [
                    'menu-item',
                    this.isCollapsed ? 'collapsed-menu' : ''
                ]
            }
        },
        methods: {
            collapsedSider () {
                this.$refs.side1.toggleCollapse();
            }
        }
    }
</script>
<style scoped lang="less" rel="stylesheet/less">
    #app {
        height: 100%;
    }
    .layout{
        border: 1px solid #d7dde4;
        background: #f5f7f9;
        position: relative;
        border-radius: 4px;
        overflow: hidden;
    }
    .layout-header-bar{
        background: #fff;
        box-shadow: 0 1px 1px rgba(0,0,0,.1);
    }
    .layout-logo-left{
        width: 90%;
        height: 30px;
        background: #5b6270;
        border-radius: 3px;
        margin: 15px auto;
    }
    .menu-icon{
        transition: all .3s;
    }
    .rotate-icon{
        transform: rotate(-90deg);
    }
    .menu-item span{
        display: inline-block;
        overflow: hidden;
        width: 69px;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: bottom;
        transition: width .2s ease .2s;
    }
    .menu-item i{
        transform: translateX(0px);
        transition: font-size .2s ease, transform .2s ease;
        vertical-align: middle;
        font-size: 16px;
    }
    .collapsed-menu span{
        width: 0px;
        transition: width .2s ease;
    }
    .collapsed-menu i{
        transform: translateX(5px);
        transition: font-size .2s ease .2s, transform .2s ease .2s;
        vertical-align: middle;
        font-size: 22px;
    }
    /*.layout {
        !*border: 1px solid #d7dde4;*!
        background: #f5f7f9;
        position: relative;
        !*border-radius: 4px;*!
        overflow: hidden;
        height: 100%;
    }

    .layout-menu-left {
        background: #464c5b;
    }

    .layout-header {
        background: #fff;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
    }

    .layout-logo-left {
        width: 90%;
        height: 30px;
        background: #5b6270;
        border-radius: 3px;
        margin: 15px auto;
    }

    .layout-ceiling-main {
        a {
            color: #9ba7b5;
        }
    }

    .layout-copy{
        position: fixed;
        bottom: 0px;
        left: 54%;
        text-align: center;
        padding: 10px 0 20px;
        color: #9ea7b4;
    }
    .ivu-col {
        transition: width .2s ease-in-out;
    }*/
</style>